# 测试两个摄像头是否正常，按Esc退出
import cv2

Left_cameraCapture = cv2.VideoCapture(0)
Right_cameraCapture = cv2.VideoCapture(1)
success1, frame1 = Left_cameraCapture.read()
success2, frame2 = Right_cameraCapture.read()
while success1 and success2:
    if cv2.waitKey(1) == 27:
        break
    cv2.imshow('Left camera', frame1)
    cv2.imshow('Right camera', frame2)
    success1, frame1 = Left_cameraCapture.read()
    success2, frame2 = Right_cameraCapture.read()

Left_cameraCapture.release()
Right_cameraCapture.release()
